﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MJM.Principal;
using MJM.RPP.EntidadesNegocio;

namespace wRegPadron.Formularios
{
    public partial class PersonasCEC : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List<PersonaE> lst = MediadorCN.GetPersona().ListarPersonaCEC();
                int count = 0;
                int count1 = 0;
                int count2 = 0;
                int count3 = 0;
                for (int i = 0; i < lst.Count; i++)
                {
                    if (lst[i].IDPersona.Substring(0, 6) == (DateTime.Now.Year.ToString().Substring(2,2) + (DateTime.Now.Month + 100).ToString().Substring(1, 2) + (DateTime.Now.Day + 100).ToString().Substring(1, 2)))                    
                        count++;                    
                    if (lst[i].IDTipoDocumento == 0)
                        count1++;
                    if (lst[i].IDTipoDocumento == 1)
                        count2++;
                    if (lst[i].IDTipoDocumento == 2)
                        count3++;
                }
                lblCantidadHoy.Text = count.ToString();
                lblTotal.Text = lst.Count.ToString();
                lblActivos.Text = count2.ToString();
                lblInactivos.Text = count3.ToString();
                lblSin.Text = count1.ToString();
                rPersonas.DataSource = lst;
                rPersonas.DataBind();
            }
        }
    }
}